{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { fillLegacyProps } from \"../utils/legacyUtil\";\nexport default (function (treeData, searchValue, _ref) {\n  var treeNodeFilterProp = _ref.treeNodeFilterProp,\n    filterTreeNode = _ref.filterTreeNode,\n    fieldNames = _ref.fieldNames;\n  var fieldChildren = fieldNames.children;\n  return React.useMemo(function () {\n    if (!searchValue || filterTreeNode === false) {\n      return treeData;\n    }\n    var filterOptionFunc;\n    if (typeof filterTreeNode === 'function') {\n      filterOptionFunc = filterTreeNode;\n    } else {\n      var upperStr = searchValue.toUpperCase();\n      filterOptionFunc = function filterOptionFunc(_, dataNode) {\n        var value = dataNode[treeNodeFilterProp];\n        return String(value).toUpperCase().includes(upperStr);\n      };\n    }\n    function dig(list) {\n      var keepAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      return list.map(function (dataNode) {\n        var children = dataNode[fieldChildren];\n        var match = keepAll || filterOptionFunc(searchValue, fillLegacyProps(dataNode));\n        var childList = dig(children || [], match);\n        if (match || childList.length) {\n          return _objectSpread(_objectSpread({}, dataNode), {}, _defineProperty({\n            isLeaf: undefined\n          }, fieldChildren, childList));\n        }\n        return null;\n      }).filter(function (node) {\n        return node;\n      });\n    }\n    return dig(treeData);\n  }, [treeData, searchValue, fieldChildren, treeNodeFilterProp, filterTreeNode]);\n});","map":{"version":3,"names":["_defineProperty","_objectSpread","React","fillLegacyProps","treeData","searchValue","_ref","treeNodeFilterProp","filterTreeNode","fieldNames","fieldChildren","children","useMemo","filterOptionFunc","upperStr","toUpperCase","_","dataNode","value","String","includes","dig","list","keepAll","arguments","length","undefined","map","match","childList","isLeaf","filter","node"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-tree-select/es/hooks/useFilterTreeData.js"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { fillLegacyProps } from \"../utils/legacyUtil\";\nexport default (function (treeData, searchValue, _ref) {\n  var treeNodeFilterProp = _ref.treeNodeFilterProp,\n      filterTreeNode = _ref.filterTreeNode,\n      fieldNames = _ref.fieldNames;\n  var fieldChildren = fieldNames.children;\n  return React.useMemo(function () {\n    if (!searchValue || filterTreeNode === false) {\n      return treeData;\n    }\n\n    var filterOptionFunc;\n\n    if (typeof filterTreeNode === 'function') {\n      filterOptionFunc = filterTreeNode;\n    } else {\n      var upperStr = searchValue.toUpperCase();\n\n      filterOptionFunc = function filterOptionFunc(_, dataNode) {\n        var value = dataNode[treeNodeFilterProp];\n        return String(value).toUpperCase().includes(upperStr);\n      };\n    }\n\n    function dig(list) {\n      var keepAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      return list.map(function (dataNode) {\n        var children = dataNode[fieldChildren];\n        var match = keepAll || filterOptionFunc(searchValue, fillLegacyProps(dataNode));\n        var childList = dig(children || [], match);\n\n        if (match || childList.length) {\n          return _objectSpread(_objectSpread({}, dataNode), {}, _defineProperty({\n            isLeaf: undefined\n          }, fieldChildren, childList));\n        }\n\n        return null;\n      }).filter(function (node) {\n        return node;\n      });\n    }\n\n    return dig(treeData);\n  }, [treeData, searchValue, fieldChildren, treeNodeFilterProp, filterTreeNode]);\n});"],"mappings":"AAAA,OAAOA,eAAe,MAAM,2CAA2C;AACvE,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,qBAAqB;AACrD,gBAAgB,UAAUC,QAAQ,EAAEC,WAAW,EAAEC,IAAI,EAAE;EACrD,IAAIC,kBAAkB,GAAGD,IAAI,CAACC,kBAAkB;IAC5CC,cAAc,GAAGF,IAAI,CAACE,cAAc;IACpCC,UAAU,GAAGH,IAAI,CAACG,UAAU;EAChC,IAAIC,aAAa,GAAGD,UA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